Repository navigation
feat(driver-kubernetes): add empty_dir workspace volume with bounded size - #4473
kon-angelo wants to merge 1 commit into
Conversation
|
All contributors have signed the DCO ✍️ ✅ |
|
I have read the DCO document and I hereby sign the DCO. |
…size Add a `workspace_volume` option to the Kubernetes compute driver so a gateway can back each sandbox's /sandbox with a size-capped emptyDir instead of a per-sandbox PVC. This lets sandboxes run on clusters that have no dynamic storage provisioning or no default StorageClass, and removes the PVC lifecycle (orphaned claims, reclaim policy) from the teardown path — kubelet reclaims the emptyDir with the Pod. - workspace_volume (persistent_volume_claim | empty_dir); default persistent_volume_claim, so existing behaviour is unchanged. - empty_dir omits volumeClaimTemplates on the Sandbox CR and mounts a pod-level emptyDir at /sandbox, sized from workspace_default_storage_size as the sizeLimit. The workspace-init container still seeds /sandbox from the image on every pod start (the volume is empty each start). - workspace_max_storage_size (default 10Gi) bounds per-sandbox size overrides so a single sandbox cannot claim an unbounded workspace and starve the node; startup validation rejects a default above the maximum. - Per-sandbox overrides via driver_config.kubernetes.workspace_volume and workspace_storage_size, honoured only on gateways that set allow_driver_config. A requested size above the gateway maximum is rejected; workspace_storage_class applies to PVCs only. - Standalone driver env: OPENSHELL_K8S_WORKSPACE_VOLUME and OPENSHELL_K8S_WORKSPACE_MAX_STORAGE_SIZE. Refs: NVIDIA#2787 Signed-off-by: Konstantinos Angelopoulos <konstantinos.angelopoulos@sap.com>
499fd96 to
2285718
Compare
|
Another data point for #2787 / #4473, from a production EKS cluster (OpenShell 0.1.5, Kubernetes driver, We run short-lived agent sandboxes whose workload never writes to
The PVC is more than half of the cold start, and a new sandbox is created for every new conversation. The |
Summary
Add a
workspace_volumeoption to the Kubernetes compute driver so a gateway can back each sandbox's/sandboxwith a size-cappedemptyDirinstead of a per-sandbox PVC. This lets sandboxes run on clusters that have no dynamic storage provisioning or no default StorageClass, and takes the PVC lifecycle (orphaned claims, reclaim policy) off the teardown path — kubelet reclaims theemptyDirwith the Pod. Default is unchanged (persistent_volume_claim).Related Issue
Closes #2787
Changes
workspace_volumegateway setting (persistent_volume_claimdefault |empty_dir); default preserves current behaviour byte-for-byte.empty_diromitsvolumeClaimTemplateson the Sandbox CR and mounts a pod-levelemptyDirat/sandbox, withsizeLimitsourced fromworkspace_default_storage_size. Theworkspace-initcontainer still seeds/sandboxfrom the image on every pod start (the volume is empty each start).workspace_max_storage_size(default10Gi) bounds per-sandbox size overrides so one sandbox cannot claim an unbounded workspace and starve the node; startup validation rejects a default above the maximum.driver_config.kubernetes.workspace_volumeandworkspace_storage_size, honoured only on gateways that setallow_driver_config. A requested size above the gateway maximum is rejected;workspace_storage_classapplies to PVCs only.OPENSHELL_K8S_WORKSPACE_VOLUME,OPENSHELL_K8S_WORKSPACE_MAX_STORAGE_SIZE.Testing
cargo test -p openshell-driver-kubernetes: 304 pass;cargo clippyclean;openshell-serverbuilds)Also verified manually on a local k3d cluster deployed with
workspace_volume = empty_dir+allow_driver_config = true:Readywith no workspace PVC; CR has novolumeClaimTemplates; Pod volume isemptyDir={"sizeLimit":"2Gi"};workspace-initseeds/sandbox.workspace_storage_size: 5Gi→sizeLimit: 5Gi;50Gi(> 10Gi max) → rejected with a clear error./sandboxis gone after stop/start (ephemeral contract).Checklist